package Week6;

import java.util.*;

public class Day32 {
}

//牛客:BC157 素数回文
class Main4 {
    //构建成回文数
    public static long change(String s){
        StringBuffer ret = new StringBuffer(s);
        for(int i = s.length() - 2; i >= 0; i--){
            ret.append(s.charAt(i));
        }
        return Long.parseLong(ret.toString());
    }

    //判断是否为素数
    public static boolean isPrime(long x){
        if(x <= 2) return false;
        for(int i = 2; i <= Math.sqrt(x); i++){
            if(x % i == 0) return false;
        }
        return true;
    }
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        String s = in.next();
        long x = change(s);
        if(isPrime(x)){
            System.out.println("prime");
        }else{
            System.out.println("noprime");
        }
    }
}

//牛客:AB31 活动安排
class Main5 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int[][] arr = new int[n][2];

        for(int i = 0; i < n; i++){
            for(int j = 0; j < 2; j++){
                arr[i][j] = in.nextInt();
            }
        }
        //排序
        Arrays.sort(arr , (v1 , v2) -> {
            return v1[0] <= v2[0] ? -1 : 1;
        });

        int ret = 0 , r = arr[0][1];
        for(int i = 1; i < n; i++){
            int a = arr[i][0] , b = arr[i][1];
            if(a >= r){
                ret++;
                r = b;
            }else{
                r = Math.min(r , b);
            }
        }
        System.out.println(ret + 1);

    }
}


//牛客:WY6 合唱团
class Main6 {
    public static int N = 55, M = 15;
    public static int n, k, d;
    public static long[] arr = new long[N];
    public static long[][] f = new long[N][M];
    public static long[][] g = new long[N][M];
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        n = in.nextInt();
        for (int i = 1; i <= n; i++) {
            arr[i] = in.nextLong();
        }
        k = in.nextInt();
        d = in.nextInt();
        // 初始化放在填表中进⾏
        for (int i = 1; i <= n; i++) { // 填写每⼀⾏
            f[i][1] = g[i][1] = arr[i];
            for (int j = 2; j <= Math.min(k, i); j++) { // 挑选 j 个⼈
                f[i][j] = Long.MIN_VALUE; // 初始化
                g[i][j] = Long.MAX_VALUE; // 初始化
                for (int prev = Math.max(i - d, j - 1); prev <= i - 1; prev++) {
                    f[i][j] = Math.max(Math.max(f[prev][j - 1] * arr[i],
                            g[prev][j - 1] * arr[i]), f[i][j]);
                    g[i][j] = Math.min(Math.min(f[prev][j - 1] * arr[i],
                            g[prev][j - 1] * arr[i]), g[i][j]);
                }
            }
        }
        long ret = Long.MIN_VALUE;
        for (int i = k; i <= n; i++) ret = Math.max(ret, f[i][k]);
        System.out.println(ret);
    }
}
